#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef struct
{
    ll a;
    ll b;
} num;
int n;
ll gcd(ll, ll);
void solve(ll, ll);
int main()
{
    cin >> n;
    num yy;
    ll Z = 0, M = 1;
    for (int i = 0; i < n; i++)
    {
        scanf("%lld/%lld", &yyr.a, &yyr.b);
        int GCD = 
    }

}
//最小公因子
ll gcd(ll a, ll b)
{
    return a % b == 0 ? b : gcd(b, a % b);
}
//通分
void solve(ll &a, ll &b)
{
    ll yue = gcd(a, b);
    if (yue)
    {
        a /= yue;
        b /= yue;
    }
}